<script setup lang="ts">
import { E_JOB_STATUS } from '@/enums/job'

interface IEmit {
  (e: 'retry'): void
}

interface IProps {
  status: E_JOB_STATUS
}

defineProps<IProps>()
const emit = defineEmits<IEmit>()

const maps: Record<E_JOB_STATUS, { text: string, color: string }> = {
  [E_JOB_STATUS.SUCCESS]: { text: '成功', color: '#1D2129' },
  [E_JOB_STATUS.FAILED]: { text: '失败', color: '#FA5566' },
  [E_JOB_STATUS.RUNNING]: { text: '执行中', color: '#00A65B' },
}
</script>

<template>
  <div class="task-status flex items-center space-x-1">
    <span :style="{ color: maps[status].color }">{{ maps[status].text }}</span>
    <!-- <i-icons-refresh
      v-if="status === E_JOB_STATUS.FAILED"
      class="cursor-pointer text-success"
      @click="emit('retry')"
    /> -->
  </div>
</template>
